#include <iostream>
#include <stdio.h>

using namespace std;

char a[3] = {'A','B','C'};

void f(int n,char a,char b,char c){
    if(n == 1){
        cout << a << "->" << b << endl;
    }
    else{
       f(n-1,a,c,b);
       cout << a << "->" << b << endl;
       f(n-1,c,b,a);
    }
}

int main() {
    int n;
    cin >> n;
    f(n,a[0],a[1],a[2]);
    return 0;
}